package com.campus.commons.utils.annotation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class ZoreOrOneForInteger  implements ConstraintValidator<ZoreOrOne,Integer> {

    @Override
    public void initialize(ZoreOrOne constraintAnnotation) {

    }

    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        if (value==null) {
            return true;
        }
        if (!(value==1||value==0)) {
            return true;
        }
        return false;
    }
}

